home *** CD-ROM | disk | FTP | other *** search
- #ifndef HEADER_DOMORPH
- #define HEADER_DOMORPH
-
- #include "fifo.h"
-
- typedef int fxp;
-
- #define DO_MORPH 0
- #define DO_TRANSFORM 1
-
- #define SHIFT 16
- #define UNIT (0x10000)
- #define HUNIT (0x08000)
- #define FP2FX(n) ((int)((float)(n)*(float)0x10000))
- #define FX2FP(n) ((float)(n) / (float)0x10000)
- #define I2FX(n) ((n)<<SHIFT)
- #define FX2I(n) (((n)+HUNIT)>>SHIFT)
-
- typedef struct {
- int x,y;
- } PXY;
-
- typedef struct {
- PXY from,to;
- } MORPH_POINT;
-
- typedef struct {
- PXY from1,from2; /* 変形前の線 */
- PXY to1,to2; /* 変形後の線 */
- } MORPH_LINE;
-
- typedef struct {
- int varType; // 現在計算中の対応座標配列
- // 0:from_x 1:from_y 2:to_x 3:to_y
- int loopCnt; // 収束計算の何回目のループか
- fxp moveMax; // 最大移動量
- fxp moveLimit; // 収束限界値
- int morphType;
- } MORPH_INFO;
-
- /* もーふの初期化 */
- /* width*height:出力画像サイズ */
- /* limit:どのくらいの誤差を許すか。普通は0.01位。値を小さくすると高画質で時間がかかる */
- /* point_num:点指定境界条件数 point:点指定境界条件 */
- /* line_num:線指定境界条件数 line:線指定境界条件数 */
- /* 線指定境界条件は連続してコネクトさせると輪郭の指定などができる */
- extern void morphInitialize(int width,int height,float limit,LIST *plPOINT,LIST *plLINE);
-
- /* もーふの終了 */
- extern void morphTerminate();
-
- /* もーふ計算の実行 */
- /* time : 0=変化前 0<中間画像<1 1=変化後 */
- int morphExec(float time, int (*func)(MORPH_INFO *info), int callCnt,
- int do_type);
-
- /* もーふ計算した色を取り出す */
- extern void morphGetColor(int x,int y, int *r,int *g,int *b);
-
- /* ユーザー側で定義する関数。必ず必要!!
- extern void morphGetFromPixel(fxp x,fxp y, int *r,int *g,int *b);
- extern void morphGetToPixel(fxp x,fxp y, int *r,int *g,int *b);
- */
-
- void morphDumpOut(char *filename,int wid,int ht);
-
- #endif
-